#include "../source/common/detail.hpp"
#include "../source/client/rpc_client.hpp"
#include <bits/this_thread_sleep.h>
void topic_test(rpc::client::TopicClient::ptr client)
{ 
    //创建主题
    bool ret = client->create("hello");
    if (ret == false)
    {
        ELOG("创建主题失败！");
    }
    //向主题发布消息
    std::this_thread::sleep_for(std::chrono::seconds(5));
    for (int i = 0; i < 10; i++)
    {
        client->publish("hello", "Hello World-" + std::to_string(i));
    }
    client->shutdown();
}
int main()//测试主题创建，发布消息
{
    auto topic_client = std::make_shared<rpc::client::TopicClient>("127.0.0.1", 7070);// 主题发布客户端
    topic_test(topic_client);
    return 0;
}